import project.testClass;

import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Highlighter;
import java.awt.*;
import java.io.IOException;

public class 测试 {
    public static void main(String[] args) throws BadLocationException, IOException {

        String str = "abcdefghijklmn";
        System.out.println(repStr(str,3,5,"111"));

    }

    private static String repStr(String str,int p0,int p1,String repStr) {
        String result = "";
        String a = str.substring(0,p0);
        String b = str.substring(p1,str.length() - 1);
        result = a + repStr + b;
        return result;

    }

    private static void createGUI() throws IOException {
        Frame frame = new Frame("111");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        frame.setSize(1000,600);
        Container container = frame.getContentPane();

    }

    public static int subCounter(String str,String subStr) {
        int count = 0;
        for (int i = 0; i < str.length() - subStr.length() + 1; i++) {
            if (str.substring(i,i + subStr.length()).equals(subStr)) {
                System.out.println(i);
                count++;
            }
        }
        return count;
    }
}
